package com.xayy.mgt.enums;

import lombok.Getter;

/**
 * @author Nie
 * @version V1.0
 * @date 2023/9/20 17:24
 */
@Getter
public enum HealthStatu {

    HEALTH(100D, 90D, "健康"),
    GOOD(90D, 75D, "良好"),
    USE(75D, 60D, "堪用"),
    FAILURE(60D, 0D, "失效"),
    ;

    HealthStatu(Double max, Double min, String level) {
        this.max = max;
        this.min = min;
        this.level = level;
    }

    private Double max;
    private Double min;

    private String level;

    public static String valueof(Double score) {
        for (HealthStatu value : values()) {
            if (score <= value.max && score > value.min)
                return value.level;
        }
        return "失效";
    }


}
